All Functions of Week 2

cut

{base}

Convert Numeric to Factor

geom_jitter

{GGPLOT2}

Add randomly displaced points to reduce overplotting

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

sd

{stats}

Get standard deviation of a vector

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

element_text

{GGPLOT2}

Customise text in GGPLOT2

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

filter

{dplyr}

Filter out rows of a data frame according to logical vector

recode

{dplyr}

Recode a variable

pwr.r.test

{pwr}

Power analysis for correlation tests

prop.table

{base}

Transform frequency table into table of proportions

geom_point

{GGPLOT2}

Generates a scatter plot

chisq.test

{stats}

Chi-Squared test (e.g. for cross-tabulations)

complete.cases

{stats}

Find Complete Cases

select

{dplyr}

Select columns from a tibble/data frame

library

{base}

Load an R package

is.na

{base}

Check if a value is NA/elements of vector are NA

sum

{base}

Get sum of numeric values or a vector

datasummary

{modelsummary}

Create customizable summary-statistics tables

theme

{GGPLOT2}

Customize ggplot themes

cor.test

{stats}

Test for Association/Correlation Between Paired Samples

factor

{base}

Create factor variables

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

as.integer

{base}

Convert an object to integer values

geom_smooth

{GGPLOT2}

Generates a smoothed conditional means curve / line

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

correlation_matrix

{corrtable}

Create a formatted correlation matrix of variables

margin

{GGPLOT2}

Set margins around plot elements (used inside theme elements)

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

mutate

{dplyr}

Create new variables

mean

{base}

Get mean of a vector

c

{base}

Combine values/vectors into a vector

round

{base}

Rounds numbers

vdem

{vdemdata}

V-Dem country-year dataset

ggplot

{GGPLOT2}

Create a ggplot graph

labs

{GGPLOT2}

Customise labels in GGPLOT2

factor

{base}

Create a factor

The end!